<?php

class Form_Criticise extends Zend_Form
{

    public function init()
    {
    	$id = new Zend_Form_Element_Hidden("id");
        //$id->setLabel("Id: ");
        $id->setValue(0);
        $id->setRequired(true);
        $idValidator = new Zend_Validate_Int();
        $id->addValidator($idValidator);
        $this->addElement($id, "id");
        
        
        $title = new Zend_Form_Element_Text("title");
        $title->setLabel("Title: ");
        $titleValidator = new Zend_Validate_Alnum();
        //$title->addValidator($nameValidator);
        $this->addElement($title, "title");
        
        
        $artist = new Zend_Form_Element_Select("artist");
        $artist->setLabel("Artist: ");
        $artistValidator = new Zend_Validate_Int();
        $artist->addValidator($artistValidator);
        
        $table = new Model_DbTable_Artist();
        $artists = $table->fetchAll();
        foreach ($artists as $theArtist){
        	$artist->addMultiOption($theArtist->id, $theArtist->name);
        }
        $this->addElement($artist, "artist");
        
        
        $reviewer = new Zend_Form_Element_Select("reviewer");
        $reviewer->setLabel("Reviewer: ");
        $reviewerValidator = new Zend_Validate_Int();
        $reviewer->addValidator($reviewerValidator);
        
        $table = new Model_DbTable_Reviewer();
        $reviewers = $table->fetchAll();
        foreach ($reviewers as $theReviewer){
        	$reviewer->addMultiOption($theReviewer->id, $theReviewer->name);
        }
        $this->addElement($reviewer, "reviewer");
        
        
        
        $intro = new Zend_Form_Element_Textarea("content");
        $intro->setLabel("Criticise: ");
        $intro->setAttrib("class", "ckeditor");
        $this->addElement($intro, "content");
        
        $display_positions = new Zend_Form_Element_Select("display_position");
        $display_positions->setLabel("Display Positions: ");
        $display_positions->addMultiOption(0, "默认（普通批评列表页）");
        $display_positions->addMultiOption(1, "首页推荐");
        $displayPositionValidator = new Zend_Validate_Int();
        $display_positions->addValidator($displayPositionValidator);
        $this->addElement($display_positions, "display_position");
        
        
        $submit = new Zend_Form_Element_Submit("submit");
        $this->addElement($submit, "submit");
    }


}

